var req;
/**
 * 用户名验证
 */
function setErrorMessage() {
    var url = "errorMessage.jsp";
     
    if(window.XMLHttpRequest){
    	//针对FireFox，MOzillar，Opear，Safari，IE7，IE8这些浏览器
    	req = new XMLHttpRequest();
    }
    else if(window.ActiveXObject){
    	//针对IE5，IE6 
    	//两个可以用于创建XMLHttpRequest对象的控件名称，保存在一个js的数组中 
    	var activeName = [ "MSXML2.XMLHTTP","Microsoft.XMLHTTP" ];
    	//= new ActiveXObject(""); 
    	for ( var i = 0; i < activeName.length; i++ ){ 
	    	//取出一个空间名进行创建，如果创建成功，种植 
	    	//如果创建失败，则抛出异常，然后可以继续循环，继续尝试创建 
	    	try { 
	    		req = new ActiveXObject( activeName[i] ); 
	    	} catch ( e ) { 
	    	} 
    	}

    }

    req.open("GET",url,true);
    req.onreadystatechange = callback;
    req.send(null);
}

function callback() {
	if (req.readyState == 4) {
		if (req.status == 200) {
			var msg = req.responseXML.getElementsByTagName("msg")[0];
			setMsg(msg.childNodes[0].nodeValue);
		}
	}
}

function setMsg(msg) {
	var mdiv = document.getElementById("errorMessage");
	if (msg != "") {
		mdiv.innerHTML = "<span></span>" + msg;
	} else {
		mdiv.innerHTML = "";
	}
}
